//
//  ShowDataListPlugin.m
//  PCDBankSix
//
//  Created by APPLE on 2023/8/24.
//

#import "ShowDataListPlugin.h"
#import "DataListSelectedView.h"
@interface ShowDataListPlugin () <BRDateResultDelegate>

@property(nonatomic,copy) NSString *strCallBack;

@end
@implementation ShowDataListPlugin

- (void)handler:(id)data andContext:(PCDContext *)context ResponseCallback:(WVJBResponseCallback )responseCallback{
    
    NSDictionary *dictData = (NSDictionary *)data;
    NSString *strCallback = dictData[@"success"];
    NSString *text = dictData[@"text"];
    NSArray *dataList = dictData[@"dataList"];
    self.strCallBack = strCallback;
    
    __weak typeof(self) weakSelf = self;
    DataListSelectedView *selectedView = [[DataListSelectedView alloc]initWithSelectValue:text dataArray:dataList];
    selectedView.delegate = self;
    [selectedView showWithAnimation:YES];
}

-(void)getDatePickerResult:(NSString *)date {
    NSDictionary *dict = @{@"text":date};
    evaluateJavaScriptOnMainThread(self,self.strCallBack,[dict JSONRepresentation]);
}



@end
